import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';

@Entity('dishes')
export class dishes {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  merchant_id: number;

  @Column()
  category_id: number;

  @Column({ default: null })
  name: string;

  @Column({ default: null,type:'json'  })
  specs_form: string;

  @Column({ default: null,type:'decimal'})
  price: number;

  @Column({ default: null,type:'decimal'})
  original_price: number;
  
  @Column({ default: null,type:'json' })
  image_urls: string;

  @Column({ default: null })
  image: string;

  @Column({ default: null })
  description: string;

  @Column({ default: 0})
  is_featured: number;
  
  @Column({ default: 0})
  status: number;

  @Column({ default: 5.0,type:'decimal' })
  rating: number;

  @Column({ default: 0 })
  sales: string;

  @Column({default: () => 'CURRENT_TIMESTAMP'})
  create_time: Date;

  @Column({default: () => 'CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'})
  update_time: Date;
}
@Entity('dish_categories')
export class dishCategories {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  merchant_id: number;

  @Column({ default: null })
  name: string;

  @Column({ default: 0 })
  sort_order: number;

  @Column({ default: 1})
  status: number;

  @Column({default: () => 'CURRENT_TIMESTAMP'})
  create_time: Date;

  @Column({default: () => 'CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'})
  update_time: Date;
}
